This replication archive contains all of the materials necessary to reproduce the simulation results detailed in the study (presented in the Supplementary Materials document). The replication archive contains six main folders, the contents of which are described below:

1. code
2. data
3. figs
4. objects
5. results
6. tables

All contents of this replication archive should be maintained within their current directory structure in order to allow for the R scripts to properly access necessary files. 

The R version employed in the creation of this replication archive was R version 4.1.2 (2021-11-01, "Bird Hippie"). The R packages used are 'data.table' (1.14.2), 'dplyr' (1.0.7), 'ggplot2' (3.3.5), 'glmnet' (4.1.3), 'gridExtra' (2.3), and 'tidyr' (1.2.0). Runtimes for the R scripts can be found at the end of this document.


(1) The 'code' folder contains 28 R scripts and an additional subfolder ('code/helper') containing functions that are sourced by these R scripts.

The script '0_main.R' sources the other 27 R scripts in the appropriate sequence to produce the simulated data, perform the analyses, and produce all figures and tables. The scripts are numbered according to the order in which they should be run to undertake replication. The specific scripts that produce the figures (Figure 1-9, Supplementary Materials) and tables (Table 2, Supplementary Materials) are named explicitly.


(2) The 'data' folder contains the simulated data, stored as Rdata files and generated by the code file '1_generate_data.R'. The files are numbered according to the simulation scenario to which they pertain.

The files beginning with "d" are data.frames that delineate the 2304 possible profiles (profile_no), with each row denoting a unique profile and the columns representing the 8 attributes (Var1 - Var8), as well as their first- and second-order interactions. The files beginning with "dutil" are data.frames that include the utility (util) each simulated voter (rid) has for each possible profile (profile_no). Each row represents a voter-profile pair. The files beginning with "dconjoint" are lists of data.frames, where each data.frame represents a simulated conjoint dataset in which the simulated voters (rid) were shown pairs (cid) of randomly generated profiles and chose (chosen) the profile (pid) in that pair for which they had the higher utility (util). The profiles are comprised of the 8 attributes (Var1 - Var8), and each of the 2304 possible unique profiles are numbered (profile_no) in correspondence with the "d" and "dutil" files.


(3) The 'figs' folder contains the figures produced by the replication code and featured in the study (Figures 1-9, Supplementary Materials).


(4) The 'objects' folder contains intermediary objects/results of the simulations and analysis that are produced by various scripts, stored as Rdata files, and then sourced by subsequent scripts.


(5) The 'results' folder contains the final main results of each of the simulations, stored as csv files. These are the results that comprise the basis for Figures 1-3 and 7-9 (Supplementary Materials).


(6) The 'tables' folder contains the results presented in Table 2 (Supplementary Materials).


(*) Approximate runtimes for the R scripts on a standard laptop (Intel Core i7-11800H @ 2.30 GHz, 32.00 GB RAM, Windows 11 64-bit) can be found below.

Runtimes:

code/1_generate_data.R: ~9 hours
code/2_generate_target_distribution_pairs.R: <1 minute
code/3a_compute_true_voteshares_sim1.R: ~18 hours
code/3b_compute_true_voteshares_sim2.R: ~18 hours
code/3c_compute_true_voteshares_sim3.R: ~18 hours
code/4a_compute_true_probwin_QOI_sim1.R: <1 minute
code/4b_compute_true_probwin_QOI_sim2.R: <1 minute
code/4c_compute_true_probwin_QOI_sim3.R: <1 minute
code/5a_estimate_probwin_QOI_sim1.R: ~3 hours
code/5b_estimate_probwin_QOI_sim2.R: ~3 hours
code/5c_estimate_probwin_QOI_sim3.R: ~3 hours
code/6a_create_Figure1.R: <1 minute
code/6b_create_Figure2.R: <1 minute
code/6c_create_Figure3.R: <1 minute
code/6d_create_Table2.R: <1 minute
code/7a_create_Figure4.R: ~1 minute
code/7b_create_Figure5.R: ~1 minute
code/7c_create_Figure6.R: ~1 minute
code/8a_compute_true_fracpref_QOI_sim1.R: ~20 minutes
code/8b_compute_true_fracpref_QOI_sim2.R: ~20 minutes
code/8c_compute_true_fracpref_QOI_sim3.R: ~20 minutes
code/9a_estimate_fracpref_QOI_sim1.R: ~3 hours
code/9b_estimate_fracpref_QOI_sim2.R: ~3 hours
code/9c_estimate_fracpref_QOI_sim3.R: ~3 hours
code/10a_create_Figure7.R: <1 minute
code/10b_create_Figure8.R: <1 minute
code/10c_create_Figure9.R: <1 minute
